package com.sly.demo.mapstruct.mapper;

import com.sly.demo.mapstruct.model.po.Order;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * 订单Mapper（这里只做DEMO示范，因此没有去真正按照查询数据库去写）
 * @author SLY
 * @date 2022/8/7
 */
@Component
public class OrderMapper {
    public List<Order> findOrderList(){
        List<Order> list = new ArrayList<>();
        for (int i = 0; i < 2; i++) {
            Order order = new Order();
            order.setId(i + 1);
            order.setOrderNum("No" + order.getId());
            order.setCreateTime(new Date());
            order.setAmount(new BigDecimal(i + 1));
            list.add(order);
        }
        return list;
    }
}
